package user.classify;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import JDBC.DatabaseDao;
import vo.User;
//import dao.UserDao;

/**计算用户的profile属性
 * @author Liang Guo
 *
 * 2013-11-26
 */
public class UserProfileFeature{
//	//计算profile feature需要用到的用户属性
//	String user_id;
//	int followers;
//	int friends;
//	int statuses_count;
//	String location;
//	String description;
//	int verify;
//	String date_account_creation;
	
	public static void main(String [] args){
		
//		Vector<User> user_vector=new Vector<User>();
		
		try {
			String sql = "select * from GaoKao_users";
//			String sql = "select top 5000 * from GaoKao_users order by NewId()";
			Statement stmt = DatabaseDao.getConnection().createStatement();
			ResultSet rs = stmt.executeQuery(sql);
			int V=0;
			while (rs.next()) {
				User GaoKao_users=new User();
				// 基本信息
				GaoKao_users.setUserId(rs.getString("user_id"));
//				GaoKao_users.setGender(rs.getString("gender"));
//				GaoKao_users.setName(rs.getString("name"));
				GaoKao_users.setScreenName(rs.getString("screen_name"));
				GaoKao_users.setDescription(rs.getString("description"));
				GaoKao_users.setVerified(rs.getInt("verified"));
				GaoKao_users.setCreatedAt(rs.getString("created_at"));
				// 地点信息
//				GaoKao_users.setProvince(rs.getString("province"));
//				GaoKao_users.setCity(rs.getString("city"));
				GaoKao_users.setLocation(rs.getString("location"));
				// 统计信息
				GaoKao_users.setFollowsCount(rs.getInt("followers_count"));
				GaoKao_users.setStatusesCount(rs.getInt("statuses_count"));
				GaoKao_users.setFriendCount(rs.getInt("friends_count"));
				GaoKao_users.setStatusesFrequency(rs.getDouble("statuses_frequency"));
				System.out.println(GaoKao_users.getScreenName()+":"+GaoKao_users.getStatusesFrequency());
//				dao.UserDao.getAll();
//				System.out.println(GaoKao_users.getFollowsCount()+'\n');
				if(GaoKao_users.getVerified()>0){//统计通过V验证的用户数
					V++;
				}
//				System.out.println(GaoKao_users.getVerified());
			}
			System.out.println(V);
			
		} catch (Exception e) {
			e.printStackTrace();
		}	
	}
}

